package org.yray.sip.rtp.sender;


import io.netty.util.Timeout;
import io.netty.util.TimerTask;
import lombok.extern.slf4j.Slf4j;
import org.yray.sip.rtp.server.UrtpServerHandler;

import java.net.InetSocketAddress;

@Slf4j
public class RtpSendTask implements TimerTask {

    private UrtpServerHandler urtpServerHandler;
    private byte[] bs;
    private InetSocketAddress sender;
    private int sn;
    public RtpSendTask(UrtpServerHandler urtpServerHandler, byte[] bs, InetSocketAddress sender,int sn)
    {
        this.urtpServerHandler=urtpServerHandler;
        this.bs=bs;
        this.sender=sender;
        this.sn=sn;
    }
    @Override
    public void run(Timeout timeout) throws Exception {
        //log.info("send rtp,sn={},time={}",sn,System.currentTimeMillis());
        urtpServerHandler.send(bs,sender);
    }
}
